<?php

namespace App\Models;

use App\User;
// use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Company extends User {

    // use SoftDeletes;

    public $table = 'users';

    public function scopeOfAll($query)
    {
        // dd(config('setting.companyGroup'));
        $query->select('users.id', 'users.company', 'roles.display_name as role_name', 'users.updated_at', 'users.email')
            ->leftJoin('role_user', 'users.id', '=', 'role_user.user_id')
            ->leftJoin('roles', 'roles.id', '=', 'role_user.role_id')
            ->where('roles.name', config('setting.companyGroup'));

        return $query;
    }

}
